/*
Illuminator (LED drawing tool for iPhone)
Copyright (C) 2008
Nik S Denin
Ivan A Vlasov
Dmitriy A Jackovlev

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#import "SettingsView.h"

@implementation SettingsView

- (id)initWithFrame:(CGRect)frame
{
	if ((self = [super initWithFrame:frame]) != nil)
	{
		m_table = [[UIPreferencesTable alloc] initWithFrame:frame];
		[m_table setDelegate:self];
		[m_table setDataSource:self];
		[m_table setScrollingEnabled:YES];
		[m_table setReusesTableCells:NO];
	}
	return self;
}

/* we have to define number of groups in our table */
- (int)numberOfGroupsInPreferencesTable:(UIPreferencesTable *)table
{
	return 3;
}

/* we have to define number of rows in each group of table */
- (int)preferencesTable:(UIPreferencesTable *)table numberOfRowsInGroup:(int)group
{
	switch (group)
	{
		case 0: return 2; break;
		case 1: return 1; break;
		default: break;
	}
}

- (float)preferencesTable:(UIPreferencesTable *)table heightForRow:(int)row inGroup:(int)group withProposedHeight:(float)proposed
{
	/* first group's label height */
	if (group == 0 && row == -1) return proposed;
	/* first group's first row's height */
	if (group == 0 && row == 0) return proposed;
	/* first group's second row's height */
	if (group == 0 && row == 1) return proposed;

	/* second group's label heightвысота метки второй группы */
	if (group == 1 && row == -1) return proposed;
	/* высота первого ряда второй группы */
	if (group == 1 && row == 0) return proposed;

	return proposed;
}

- (UIPreferencesTableCell *)preferencesTable:(UIPreferencesTable *)table cellForGroup:(int)group
{
	// I know what it is needed for. Hobbut
	// And I now. werewolf
	// Ash to ash, dust to dust. Bible
	UIPreferencesTableCell *cell = [[UIPreferencesTableCell alloc] init];
	[cell setTitle:@""];
	return [cell autorelease];
}

- (BOOL)preferencesTable:(UIPreferencesTable *)table isLabelGroup:(int)group
{
	return NO;
}

- (UIPreferencesTableCell *)preferencesTable:(UIPreferencesTable *)table cellForRow:(int)row inGroup:(int)group
{
	UIPreferencesTableCell *cell = [[UIPreferencesTableCell alloc] init];
	switch (group)
	{
		case 0:
		{
			switch (row)
			{
				case 0:
				break;
				case 1:
				break;
				default:
				break;
			}
		}
		break;
		case 1:
		break;
		default:
		break;
	}
	return [cell retain];
}

- (void)setDelegate:(id)delegate
{
	m_delegate = delegate;
}

- (void)dealloc
{
	[super dealloc];
}

@end // SettingsView
